<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript">
        function doDelete(cid){
            var flag = confirm("您确定删除购物车吗？")
            if(flag){
                window.location.href="${pageContext.request.contextPath}/user/deleteCart?cid="+cid;
            }
        }
    </script>
</head>
<body>
<h1>添加订单信息</h1>
<div class="container">

    <div class="row clearfix">
        <div class="col-md-12 column">
            <form action="${pageContext.request.contextPath}/user/updateComment" method="post">
                <div style="border: 2px solid #a1a1a1;padding: 10px 40px;border-radius: 25px;">
                    <input type="hidden" name="oid" value="${comment.oid}">
                    <div class="form-group">
                        <label for="comm">评论：</label>
                        <input type="text" name="comm" class="form-control" id="comm" value="${comment.comm}" required>
                    </div>
                    <div class="form-group">
                        <label for="reply">回复：</label>
                        <input type="text" name="reply" class="form-control" id="reply" value="${comment.reply}" readonly>
                    </div>
                    <button type="submit" class="btn btn-default">提交信息</button>
                    <a href="${pageContext.request.contextPath}/user/allOrderInfo?oid=${comment.oid}" class="btn btn-primary">取消</a>
                </div>

            </form>

        </div>

        <c:forEach var="pic" items="${comment.pics}" end="3">
                <div class="col-md-4 column" style="border: 2px solid #a1a1a1;padding: 10px 40px;border-radius: 25px;">
                    <c:choose>
                        <c:when test="${pic!=null}">
                            <form action="${pageContext.request.contextPath}/user/updateCommPic" method="post" enctype="multipart/form-data">
                                <input type="hidden" name="picid" value="${comment.picid}">
                                <input type="hidden" name="oid" value="${comment.oid}">
                                <div class="form-group">
                                    <label>原图：</label>
                                    <img src="${pageContext.request.contextPath}/comment/${pic}" width="300px" height="200px">
                                    <input type="hidden" name="oldPic" class="form-control" value="${pic}" required>
                                </div>
                                <div class="form-group">
                                    <label>新图片：</label>
                                    <input type="file" name="newPicture" class="form-control">
                                </div>
                                <button type="submit" class="btn btn-default">提交</button>
                            </form>
                        </c:when>
                        <c:otherwise>
                            <form action="${pageContext.request.contextPath}/user/addCommPic" method="post" enctype="multipart/form-data">
                                <input type="hidden" name="picid" value="${comment.picid}">
                                <div class="form-group">
                                    <label>新图片：</label>
                                    <input type="file" name="newPicture" class="form-control">
                                </div>
                                <button type="submit" class="btn btn-default">提交</button>
                            </form>
                        </c:otherwise>
                    </c:choose>

                </div>
        </c:forEach>
    </div>


</div>


</body>
</html>
